package com.ferret.controller;


import cn.hutool.json.JSONObject;
import com.ferret.service.RyGzryxxcjService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OpenApiController {
    public Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private RyGzryxxcjService ryGzryxxcjService;

    @RequestMapping(value = "/openApi/qeuryIsZk",method = RequestMethod.GET)
    public ResponseEntity<?> qeuryIsZk(@RequestParam("gmsfhm") String gmsfhm,@RequestParam("regionalCode") String regionalCode) {
        try {
            JSONObject resJson = ryGzryxxcjService.qeuryIsZk(gmsfhm,regionalCode);
            return ResponseEntity.ok(resJson);
        } catch (Exception e) {
            logger.error("qeuryIsZk error:{}", e);
            return ResponseEntity.badRequest().body("查询失败");
        }
    }
}
